package com.you.raft.common.entity;


import lombok.*;

import java.io.Serializable;


@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@ToString
@Builder
public class VoteResponse implements Serializable {

    /**
     * 当前任期号，以便于候选人去更新自己的任期
     */
    long term;

    /**
     * 候选人赢得了此张选票时为真
     */
    boolean voteGranted;


    private final static VoteResponse FAIL;

    static {
        FAIL = new VoteResponse();
        FAIL.setVoteGranted(false);
    }

    public static VoteResponse fail() {
        return FAIL;
    }

}
